package ar.edu.unlu.sistemas.movirdroid.business.vo;

import java.io.Serializable;

public class DocumentVO implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3152286589394083837L;
	private int id;
	private String name;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	public String toString() {
		return this.getName();
	}
	
	@Override
	public boolean equals(Object o) {
		if (super.equals(o)) return true;
		else {
			if (o instanceof DocumentVO) {
				DocumentVO anotherDoc = (DocumentVO) o;
				if (this.getId() == anotherDoc.getId() || 
						(this.getName() != null && this.getName().equals(anotherDoc.getName()))) 
					return true;
			}
			return false;
		}
	}
	
	@Override
	public int hashCode() {
		String name = this.getName() != null ? this.getName() : "";
		return super.hashCode() + new Integer(this.getId()).hashCode() + name.hashCode();
	}
	
	
	
}
